/* 主页布局样式 */

.home-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: fixed;
  top: 0;
  left: 0;
  background: #f5f5f5;
  overflow: hidden;
}

/* 左侧边栏 */
.sidebar {
  width: 180px;
  min-width: 180px;
  background: white;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}

.sidebar.collapsed .logo-text {
  font-size: 12px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48px;
  transition: all 0.3s ease;
}

.sidebar.collapsed .username {
  font-size: 10px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48px;
  transition: all 0.3s ease;
}

.sidebar:not(.collapsed) .logo-text {
  font-size: 20px;
  opacity: 1;
  max-width: none;
  transition: all 0.3s ease 0.1s;
}

.sidebar:not(.collapsed) .username {
  font-size: 14px;
  opacity: 1;
  max-width: none;
  transition: all 0.3s ease 0.1s;
}

.sidebar.collapsed .sidebar-header {
  padding: 16px 8px;
  text-align: center;
}

.sidebar.collapsed .logo {
  justify-content: center;
  margin-bottom: 12px;
  flex-direction: column;
  gap: 4px;
}

.sidebar.collapsed .user-info {
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.sidebar-header {
  padding: 20px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.logo-text {
  font-weight: 600;
  color: #18a058;
  transition: all 0.3s ease;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.username {
  color: #666;
  transition: all 0.3s ease;
}

.menu-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.menu-container :deep(.n-menu) {
  background: transparent;
}

.menu-container :deep(.n-menu-item) {
  margin: 4px 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.menu-container :deep(.n-menu-item-content) {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.menu-container :deep(.n-menu-item-content-header) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.sidebar.collapsed .menu-container :deep(.n-menu-item) {
  margin: 4px 8px;
}

.sidebar.collapsed .menu-container :deep(.n-menu-item-content) {
  justify-content: center;
}

.menu-container :deep(.n-menu-item-content) {
  transition: all 0.3s ease;
}

.sidebar.collapsed .menu-container :deep(.n-menu-item-content-header) {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.menu-container :deep(.n-menu-item:hover) {
  background: #f0f9ff;
}

.menu-container :deep(.n-menu-item.n-menu-item--selected) {
  background: #e6f4ff;
  color: #1890ff;
}

.menu-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-icon svg {
  width: 100%;
  height: 100%;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: center;
}

.collapse-btn {
  width: 40px;
  height: 40px;
}

/* 右侧内容区域 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.content-header {
  height: 64px;
  background: white;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.breadcrumb :deep(.n-breadcrumb-item) {
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: #f5f5f5;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .sidebar {
    width: 64px;
    min-width: 64px;
  }
  
  .sidebar .logo-text {
    font-size: 10px;
    opacity: 0.6;
    max-width: 48px;
  }
  
  .sidebar .username {
    font-size: 9px;
    opacity: 0.5;
    max-width: 48px;
  }
  
  .content-body {
    padding: 16px;
  }
}

/* 确保内部组件也遵循布局约束 */
.content-body :deep(*) {
  max-width: 100%;
  box-sizing: border-box;
}

/* 防止内容溢出 */
.content-body :deep(.n-card),
.content-body :deep(.n-form),
.content-body :deep(.n-table) {
  max-width: 100%;
  overflow-x: auto;
}
